<script>
import ECharts from 'vue-echarts'
import 'echarts/lib/chart/line'
import 'echarts/lib/component/polar'
export default {
  name: 'NoticeCount',
  components: {
    'v-chart': ECharts
  },
  data() {
    return {
      memoryInfo: {
        title: {
          text: '近一周消息推送情况'
        },
        tooltip: {
          trigger: 'axis'
        },
        legend: {
          data: ['近一周消息推送情况']
        },
        xAxis: {
          type: 'category',
          boundaryGap: false,
          data: ['2025/01/01', '2025/01/02', '2025/01/03', '2025/01/04', '2025/01/05', '2025/01/06', '2025/01/07']
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            name: '消息推送量',
            type: 'line',
            data: [5, 23, 94, 934, 12, 324, 93]
          }]
      },
      memoryInfo2: {
        title: {
          text: '近一周教师推送情况'
        },
        tooltip: {
          trigger: 'axis'
        },
        legend: {
          data: ['近一周教师推送情况']
        },
        xAxis: {
          type: 'category',
          boundaryGap: false,
          data: ['2025/01/01', '2025/01/02', '2025/01/03', '2025/01/04', '2025/01/05', '2025/01/06', '2025/01/07']
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            name: '消息推送量',
            type: 'line',
            data: [2, 23, 60, 35, 12, 128, 31]
          }]
      }
    }
  }
}
</script>

<template>
  <div class="custom-content-body">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="font-weight: bold;color: #666;font-size: 15px">消息统计</span>
      </div>
      <div>
        <el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6" style="margin-bottom: 10px">
          <div class="title">消息成功率</div>
          <el-tooltip placement="top-end">
            <div slot="content" style="font-size: 12px;">
              <div style="padding: 3px;">
                总推送量：298822
              </div>
              <div style="padding: 3px">
                成功推送量：278343
              </div>
              <div style="padding: 3px">
                今日共推送：93
              </div>
              <div style="padding: 3px">
                今日成功推送：93
              </div>
            </div>
            <div class="content">
              <el-progress type="circle" :percentage="parseFloat('93.14')" />
            </div>
          </el-tooltip>
          <div class="footer"> 消息推送情况</div>
        </el-col>
        <el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6" style="margin-bottom: 10px">
          <div class="title">微信渠道</div>
          <el-tooltip placement="top-end">
            <div slot="content" style="font-size: 12px;">
              <div style="padding: 3px;">
                总推送量：154894
              </div>
              <div style="padding: 3px">
                成功推送量：154894
              </div>
              <div style="padding: 3px">
                今日共推送：0
              </div>
              <div style="padding: 3px">
                今日成功推送：0
              </div>
            </div>
            <div class="content">
              <el-progress type="circle" :percentage="parseFloat('100')" />
            </div>
          </el-tooltip>
          <div class="footer"> 消息推送情况</div>
        </el-col>
        <el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6" style="margin-bottom: 10px">
          <div class="title">短信渠道</div>
          <el-tooltip placement="top-end">
            <div slot="content" style="font-size: 12px;">
              <div style="padding: 3px;">
                总推送量：3560
              </div>
              <div style="padding: 3px">
                成功推送量：3560
              </div>
              <div style="padding: 3px">
                今日共推送：0
              </div>
              <div style="padding: 3px">
                今日成功推送：0
              </div>
            </div>
            <div class="content">
              <el-progress type="circle" :percentage="parseFloat('100')" />
            </div>
          </el-tooltip>
          <div class="footer"> 消息推送情况</div>
        </el-col>
        <el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6" style="margin-bottom: 10px">
          <div class="title">站内信</div>
          <el-tooltip placement="top-end">
            <div slot="content" style="font-size: 12px;">
              <div style="padding: 3px;">
                总推送量：140368
              </div>
              <div style="padding: 3px">
                成功推送量：130368
              </div>
              <div style="padding: 3px">
                今日共推送：93
              </div>
              <div style="padding: 3px">
                今日成功推送：93
              </div>
            </div>
            <div class="content">
              <el-progress type="circle" :percentage="parseFloat('92.87')" />
            </div>
          </el-tooltip>
          <div class="footer"> 消息推送情况</div>
        </el-col>
        <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 10px">
          <el-card class="box-card">
            <div>
              <v-chart :options="memoryInfo" />
            </div>
          </el-card>
        </el-col>
        <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 10px">
          <el-card class="box-card">
            <div>
              <v-chart :options="memoryInfo2" />
            </div>
          </el-card>
        </el-col>
        <!--        <el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6" style="margin-bottom: 10px">
          <div class="title">内存使用率</div>
          <el-tooltip placement="top-end">
            <div slot="content" style="font-size: 12px;">
              <div style="padding: 3px;">
                总量：{{ data.memory.total }}
              </div>
              <div style="padding: 3px">
                已使用：{{ data.memory.used }}
              </div>
              <div style="padding: 3px">
                空闲：{{ data.memory.available }}
              </div>
            </div>
            <div class="content">
              <el-progress type="circle" :percentage="parseFloat(data.memory.usageRate)" />
            </div>
          </el-tooltip>
          <div class="footer">{{ data.memory.used }} / {{ data.memory.total }}</div>
        </el-col>
        <el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6" style="margin-bottom: 10px">
          <div class="title">交换区使用率</div>
          <el-tooltip placement="top-end">
            <div slot="content" style="font-size: 12px;">
              <div style="padding: 3px;">
                总量：{{ data.swap.total }}
              </div>
              <div style="padding: 3px">
                已使用：{{ data.swap.used }}
              </div>
              <div style="padding: 3px">
                空闲：{{ data.swap.available }}
              </div>
            </div>
            <div class="content">
              <el-progress type="circle" :percentage="parseFloat(data.swap.usageRate)" />
            </div>
          </el-tooltip>
          <div class="footer">{{ data.swap.used }} / {{ data.swap.total }}</div>
        </el-col>
        <el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6" style="margin-bottom: 10px">
          <div class="title">磁盘使用率</div>
          <div class="content">
            <el-tooltip placement="top-end">
              <div slot="content" style="font-size: 12px;">
                <div style="padding: 3px">
                  总量：{{ data.disk.total }}
                </div>
                <div style="padding: 3px">
                  空闲：{{ data.disk.available }}
                </div>
              </div>
              <div class="content">
                <el-progress type="circle" :percentage="parseFloat(data.disk.usageRate)" />
              </div>
            </el-tooltip>
          </div>
          <div class="footer">{{ data.disk.used }} / {{ data.disk.total }}</div>
        </el-col>-->
      </div>
    </el-card>
  </div>
</template>

<style lang="scss" scoped>
.custom-content-body {
  width: 100%;
  height: 100%;
  padding: 60px 20px 20px 20px;
}
::v-deep .box-card {
  margin-bottom: 5px;
  span {
    margin-right: 28px;
  }
  .el-icon-refresh {
    margin-right: 10px;
    float: right;
    cursor:pointer;
  }
}
.cpu, .memory, .swap, .disk  {
  width: 20%;
  float: left;
  padding-bottom: 20px;
  margin-right: 5%;
}
.title, .footer {
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  color: #999;
  height: 25px;
  line-height: 25px;
}
.content {
  text-align: center;
  margin-top: 5px;
  margin-bottom: 5px;
}
</style>
